package com.ruoyi.controller.achievements;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.service.achievements.AcvDepManageService;
import com.ruoyi.service.achievements.AcvScoringDataManageService;
import com.ruoyi.service.achievements.AcvScoringManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;


/**
 * @author zeo
 * @explain 退回考核数据处理
 * @date 2021/9/14
 */
@Controller
@RequestMapping("/acvScoringDataBackManage")
public class AcvScoringDataBackController extends BaseController {

    @Autowired
    AcvDepManageService acvDepManageService;

    @Autowired
    AcvScoringManageService acvScoringManageService;

    @Autowired
    AcvScoringDataManageService acvScoringDataManageService;


    private String prefix = "achievements/scoringdatabackmanage";

    @GetMapping()
    public String acvScoringDataManage(ModelMap mmap) {
        mmap.put("depList", acvDepManageService.finDepList(new HashMap()));
        mmap.put("jobList", acvDepManageService.findJobList());
        mmap.put("userName", ShiroUtils.getLoginName());
        return prefix + "/acvScoringDataBackManage";
    }

    @RequestMapping("/list")
    @ResponseBody
    public TableDataInfo list(@RequestParam Map map) {
        map.put("table","acv_scoring_back");
        return getDataTable(acvScoringManageService.list(map));
    }

    @PostMapping("/backSubmit")
    @ResponseBody
    public AjaxResult backSubmit(String scoringId){
        return toAjax(acvScoringDataManageService.backSubmit(scoringId));
    }
}
